﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ue.Infrastructure.DomainBase;
using Ue.Infrastructure.RepositoryFramework;

namespace Ue.Qcdz.Domain.SaleInfos
{
    public class SaleInfoService
    {
        private static ISaleInfoRepository _repository;
        static SaleInfoService()
        {
            _repository = RepositoryFactory.GetRepository<ISaleInfoRepository, SaleInfo>();
        }
        public static SaleInfo GetSaleInfo(object saleInfoKey)
        {
            return SaleInfoService._repository.FindBy(saleInfoKey);
        }
        public static IList<SaleInfo> GetSaleInfoKey()
        {
            return SaleInfoService._repository.FindAll();
        }
        public static IDataResult<SaleInfo> GetSaleInfo(IDataQuery dataQuery)
        {
            return SaleInfoService._repository.FindBy(dataQuery);
        }
        public static void AddSaleInfo(SaleInfo saleInfo)
        {
            SaleInfoService._repository.Add(saleInfo);
        }
        public static void UpdateSaleInfo(SaleInfo saleInfo)
        {
            SaleInfoService._repository[saleInfo.Key] = saleInfo;
        }
        /// <summary>
        /// 删除所有分类
        /// </summary>
        /// <param name="shop"></param>
        public static void RemoveAll(Shops.Shop shop)
        {
            SaleInfoService._repository.RemoveAll(shop);
        }
    }
}
